package com.group3.admin.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.group3.admin.service.IAMerchantService;
import com.group3.admin.service.impl.AMerchantServiceImpl;
import com.group3.entity.AMerchant;


/**
 * Servlet implementation class QueryAMServlet
 * 处理审核请求 
 * 	
 * 	返回 审核页面 review.jsp 
 */
//@WebServlet("/QueryAMServlet")
public class QueryAMServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	IAMerchantService iAMerchantService = new AMerchantServiceImpl();
    /**
     * @see HttpServlet#HttpServlet()
     */
    public QueryAMServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String mId = request.getParameter("mId");
		
		AMerchant aMerchant =iAMerchantService.queryAMerchantByMId(mId);		
//		AMerchant aMerchant = new AMerchant("1", "1","2", "2", "3", "3");
		
		System.out.println("QueryAMServet : Edit " + aMerchant);
		
		request.setAttribute("m", aMerchant);
		request.getRequestDispatcher("WEB-INF/review.jsp").forward(request, response); 
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}